package masterjava.common.shared.rpc;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import masterjava.common.shared.FetchContext;
import masterjava.common.shared.entity.GenericEntity;

import java.io.Serializable;
import java.util.List;

@RemoteServiceRelativePath("dao.rpc")
public interface DaoRemoteService extends RemoteService {

    GenericEntity get(String persistentClass, Serializable id);

    public List<? extends GenericEntity> loadAll(String persistentClass, FetchContext ctx);

    Serializable saveOrUpdate(GenericEntity entity);

    public void delete(String persistentClass, Serializable id);

    public List<? extends GenericEntity> findByNamedQueryAndNamedParam(final String queryName, final String[] paramNames, final Serializable[] values, FetchContext ctx);

    GenericEntity findUnique(final String queryName, final String[] paramNames, Serializable[] values);
}
